package thread;

/**
 * Created by zhangyanfei on 2019/3/29.
 * synchronize  jvm控制 m
 * @author zhangyanfei
 * @date 2019/03/29
 */
public class DeadLock {

    public static void getA(){
        synchronized (DeadLock.class) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            synchronized (String.class) {

            }
        }
    }

    public static void getB() {
        synchronized (String.class) {
            synchronized (DeadLock.class) {

            }
        }
    }

    public static void main(String[] args) {
        new Thread(DeadLock::getA).start();
        new Thread(DeadLock::getB).start();
    }
}
